package com.hgm.travelapp.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.hgm.travelapp.adapter.RecyclerViewAdapter2
import com.hgm.travelapp.databinding.FragmentOrderBinding

class OrderFragment : Fragment() {

    private val mBinding: FragmentOrderBinding by lazy {
        FragmentOrderBinding.inflate(layoutInflater)
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return mBinding.root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        mBinding.recyclerOrderList.apply {
            layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
            adapter = RecyclerViewAdapter2(childFragmentManager,1)
        }

        mBinding.back.setOnClickListener {
            activity?.supportFragmentManager?.popBackStack()
        }
    }

}